package net.mihome.app.bean;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import net.mihome.app.bean.net.ResponsePojo;

public class ChatRoom {
	public final static int MY=1;
	public final static int ALL=2;
	private int id;
	private String name;
	private String create_by_name;
	private String peopelNum;
	private String desc;
	private String time;
	private Boolean isJoin;
	private int create_by_id;
	private String create_at;
	
	
	
	public Boolean getIsJoin() {
		return isJoin;
	}
	public void setIsJoin(Boolean isJoin) {
		this.isJoin = isJoin;
	}
	public String getPeopelNum() {
		return peopelNum;
	}
	public void setPeopelNum(String peopelNum) {
		this.peopelNum = peopelNum;
	}
	public String getDesc() {
		return desc;
	}
	public void setDesc(String desc) {
		this.desc = desc;
	}

	public String getTime() {
		return time;
	}
	public void setTime(String time) {
		this.time = time;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getCreate_by_name() {
		return create_by_name;
	}
	public void setCreate_by_name(String create_by_name) {
		this.create_by_name = create_by_name;
	}
	public int getCreate_by_id() {
		return create_by_id;
	}
	public void setCreate_by_id(int create_by_id) {
		this.create_by_id = create_by_id;
	}
	public String getCreate_at() {
		return create_at;
	}
	public void setCreate_at(String create_at) {
		this.create_at = create_at;
	}
	public static ChatRoom parse(Map map){
		ChatRoom chatRoom=new ChatRoom();
		return chatRoom;
	}
	public static List<ChatRoom> parseList(ResponsePojo responsePojo){
		List<ChatRoom> list=new ArrayList<ChatRoom>();
		List<Map> maplList=(List<Map>) responsePojo.getData();
		if(maplList!=null&&!maplList.isEmpty()){
			Iterator<Map> iterator=maplList.iterator();
			while(iterator.hasNext()){
				Map map=iterator.next();
				ChatRoom chatRoom=new ChatRoom();
				Double idDouble=(Double) map.get("id");
				chatRoom.setId(idDouble.intValue());
				chatRoom.setName((String) map.get("name"));
				chatRoom.setCreate_at((String) map.get("create_at"));
				chatRoom.setCreate_by_id(((Double) map.get("create_by_id")).intValue());
				chatRoom.setCreate_by_name((String) map.get("create_by_name"));

				chatRoom.setPeopelNum((String) map.get("people_num"));
				chatRoom.setTime((String) map.get("time"));
				chatRoom.setDesc((String) map.get("desc"));
				chatRoom.setIsJoin((Boolean) map.get("isJoin"));
				list.add(chatRoom);
			}
		}
		return list;
	}
}
